home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earcd / haage&partner / stormc / radiodiallib / external_gadgets.txt next >
Text File  |  1997-11-12  |  4KB  |  114 lines

  1. How to write external gadgets for use with StormWIZARD
  2.  
  3. ® HAAGE & PARTNeR Computer GmbH
  4.  
  5. written by Jan-Claas Dirks
  6.  
  7.  
  8.  
  9. External gadgets are used to implement new elements for your GUI
  10. with new appearance and behaviour on user input.
  11.  
  12.  
  13.  
  14. For StormWIZARD, external gadgets are BOOPSI classes. They
  15. are implemented as AMIGA shared libraries. A library with an
  16. external gadget contains two public functions to add and to remove
  17. the gadget class. Basically, MakeClass() and FreeClass() are called.
  18.  
  19. Furthermore, the library contains a dispatcher that is specified
  20. in the MakeClass() call. By using this dispatcher, new gadgets
  21. are created, attributes are set and asked for, gadgets get
  22. layouted, rendered etc.. External gadgets for StormWIZARD
  23. react on standard BOOPSI dispatcher calls like OM_NEW,
  24. GM_RENDER as well on StormWIZARD-specific calls. An example
  25. are calls for the layouting process.
  26.  
  27. Further useful information on StormWIZARD external gadgets
  28. can be found in <libraries/wizardextern.h> and the
  29. Rom Kernal Manual "Libraries", BOOPSI chapter.
  30.  
  31.  
  32.  
  33. Commonly, you will have three source files for your library.
  34.  
  35. First, a .fd-file which tells the which functions to be put
  36. into the library and what the base name of the library should be.
  37. You won't have to spend too much time editing this file. The
  38. base name is of no relevance as opening, closing and calling the
  39. two public functions of this library is done by StormWIZARD.
  40. And, as the two public functions have fixed positions in the
  41. library, you don't have to edit those lines at all.
  42.  
  43. Secondly, you will have to create a header file that defines
  44. the tags that can be used to control your gadget via
  45. SetGadgetAttrs(), GetAttrs() etc.. Public enumerations etc.
  46. should be placed here, too. This header file is then included
  47. in those source files in which the gadget is being used.
  48.  
  49. Finally, the implementation of the two public functions
  50. and the dispatcher can be found in the main source file.
  51.  
  52.  
  53.  
  54. Using StormC makes the development of the library easy.
  55.  
  56. Create a new project and save it to a location of your choice.
  57. Add a .fd-, a .h- and a .c-file and confirm to create them.
  58. Select the executable as LIBS:wizard_yourlibraryname.library.
  59. Now tune the compiler and linker settings to your needs.
  60. In particular, select 'Link as shared library' at
  61. 'Program generation' on the 'Linker 1' page of the
  62. linker settings. Compiling the project places the
  63. library just where it needs to be to be found by
  64. the operating system.
  65.  
  66.  
  67.  
  68. You are now ready to test your gadget in the StormWIZARD editor.
  69.  
  70. Create a window with all the groups and gadgets
  71. you need. To use your own gadget, select the 'libraries'
  72. page and 'add' a new one. In the attribute window, give
  73. the new library object a name and specify the library
  74. name on disk (wizard_yourlibraryname.library) without
  75. the leading 'LIBS:'.
  76.  
  77. Now move to the 'gadgets' page and add an 'external' gadget.
  78. In the attribute window, select the extern page and specify
  79. the external library object you just have created.
  80. In the Data 0 .. Data 7 numberfields, you can preset
  81. attribute tags for your gadget.
  82.  
  83.  
  84.  
  85. Finally, use your gadget in your application.
  86.  
  87. In your application, you do not need to take more care
  88. about external gadgets that about StormWIZARD's gadgets.
  89. The GUI is loaded, opened and handled with the same
  90. functions of the wizard.library or that you've written
  91. by yourself.
  92.  
  93. Include the external library's header file you've written
  94. to make use of the tags you've defined to control the gadget.
  95.  
  96.  
  97.  
  98. Words are for the mind, source is for the code.
  99.  
  100. Please complain to HAAGE & Partner Computer GmbH if that
  101. phrase sounds strange to native English speakers.
  102.  
  103. However, there is a project for use with StormC
  104. to show you how to implement an external gadget.
  105. While the header and .fd-file are of a managable size,
  106. the .c-file is a good place to get lost. Useful comments
  107. and source code you will have to adapt to your needs
  108. are marked by the character sequence '//!'.
  109.  
  110. As using external gadgets in your application
  111. differs in no way from using StormWIZARD's gadgets,
  112. there is no application source example provided.
  113.  
  114.